<?php
session_start();
header("Content-type: image/jpeg");

$im = imagecreatetruecolor(150, 40);

$feher = imagecolorallocate($im, 255, 255, 255);
$fekete = imagecolorallocate($im, 0, 0, 0);
$szurke = imagecolorallocate($im, 125, 125, 125);

$chars = "abcdefghijklmnopqrstuvwxyz";
$str = "";
for ($i = 0; $i < 6; $i++) {
    $rand = rand(0, strlen($chars) - 1);
    $str.=$chars[$rand];
}
$_SESSION["captcha"] = $str;

imagefill($im, 0, 0, $feher);
imagettftext($im, 30, 10, 42, 32, $szurke, "RemachineScript_PERSONAL_USE_ONLY.ttf", $str);
imagettftext($im, 30, 10, 40, 30, $fekete, "RemachineScript_PERSONAL_USE_ONLY.ttf", $str);

imagejpeg($im);
imagedestroy($im);
?>